/*
 * Copyright 2012 Alain Pannetrat (L1L1@gmx.com)
 * 
 * This file is part of cookie-miner.
 * 
 * cookie-miner is free software: you can redistribute it and/or modify 
 * it under the terms of the GNU General Public License as published by 
 * the Free Software Foundation, either version 3 of the License, or 
 * (at your option) any later version.
 * 
 * cookie-miner is distributed in the hope that it will be useful, but 
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License 
 * along with cookie-miner. If not, see http://www.gnu.org/licenses/.
 *
 * @version: $Id$
 *
 */
#ifndef _KEYVALUE_LIST_H_
#define _KEYVALUE_LIST_H_
#include <string>
#include <list>

typedef std::pair<std::string,std::string> KeyValue;

class KeyValueList: public std::list<KeyValue> {
	public:
		iterator find(const std::string& key, unsigned index=0);
		
		const_iterator find(const std::string& key, unsigned index=0) const;

		bool set(const std::string& field, const std::string& value, unsigned index=0);
                
		bool set(const std::string& field, int value, unsigned index=0);

		const std::string& get(const std::string& field, unsigned index=0) const;

		int get_as_int(const std::string& field, unsigned index=0) const;

		unsigned exists(const std::string& key) const;

		iterator erase(iterator it);
	private:
		static std::string dummy;
};

#endif
